package com.haina.vote.entity;

import com.haina.vote.utils.DateUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class Vote {
    private Integer id;
    //投票主题名称
    private String title;
    //投票类型
    private Integer type;
    //投票类型字符串
    private String typeStr;
    //投票描述
    private String remark;
    //开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date start_time;
    //开始时间显示字符串
    private String start_timeStr;
    //结束时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date end_time;
    //结束时间显示字符
    private String end_timeStr;
    //创建时间
    private Date create_time;
    //创建时间显示字符
    private String create_timeStr;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeStr() {
        if (type!=null){
            if (type==0){
                typeStr="图片类投票";
            }
            if (type==1){
                typeStr="音频类投票";
            }
            if (type==2){
                typeStr="视频类投票";
            }
        }
        return typeStr;
    }

    public void setTypeStr(String typeStr) {
        this.typeStr = typeStr;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getStart_time() {
        return start_time;
    }

    public void setStart_time(Date start_time) {
        this.start_time = start_time;
    }

    public Date getEnd_time() {
        return end_time;
    }

    public void setEnd_time(Date end_time) {
        this.end_time = end_time;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public String getStart_timeStr() {
        if (start_time!=null){
            start_timeStr= DateUtils.DateToString(start_time,"yyyy-MM-dd hh:mm");
        }
        return start_timeStr;
    }

    public void setStart_timeStr(String start_timeStr) {
        this.start_timeStr = start_timeStr;
    }

    public String getEnd_timeStr() {
        if (end_time!=null){
            end_timeStr= DateUtils.DateToString(end_time,"yyyy-MM-dd hh:mm");
        }
        return end_timeStr;
    }

    public void setEnd_timeStr(String end_timeStr) {
        this.end_timeStr = end_timeStr;
    }

    public String getCreate_timeStr() {
       if (create_time!=null){
           create_timeStr=DateUtils.DateToString(create_time,"yyyy-MM-dd hh:mm");
       }
        return create_timeStr;
    }

    public void setCreate_timeStr(String create_timeStr) {
        this.create_timeStr = create_timeStr;
    }

    @Override
    public String toString() {
        return "Vote{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", type=" + type +
                ", typeStr='" + typeStr + '\'' +
                ", remark='" + remark + '\'' +
                ", start_time=" + start_time +
                ", start_timeStr='" + start_timeStr + '\'' +
                ", end_time=" + end_time +
                ", end_timeStr='" + end_timeStr + '\'' +
                ", create_time=" + create_time +
                ", create_timeStr='" + create_timeStr + '\'' +
                '}';
    }
}
